package com.liao.product.feign;

import com.liao.common.doc.ProductDoc;
import com.liao.common.utils.Result;
import com.liao.common.vo.SearchResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;
import java.util.List;

/**
 * @Author: ljt
 * @DateTime: 2025/3/12 下午8:47
 **/
@FeignClient("youyoumall-search")
public interface SearchFeignService {

    /**
     * 上架商品
     */
    @PostMapping("/search/save/product")
    Result productStatusUp(@RequestBody List<ProductDoc> ProductDocList);

    /**
     * 根据接收的参数查询出用户给用户推荐的产品
     *
     * @param memberId 用户id
     * @param from     从第几个开始
     * @param size     长度
     * @return List<ProductDoc>
     * @throws IOException
     */
    @GetMapping("/search/member/recommend/products")
    Result<SearchResult<ProductDoc>> recommendProducts(@RequestParam Integer memberId, @RequestParam(defaultValue = "0") Integer from, @RequestParam(defaultValue = "10") Integer size);

    /**
     * 远程调用方法搜索商品
     *
     * @return
     */
//    @GetMapping("/search/member/searchProduct")
//    Result<List<ProductDoc>> searchProduct(ProductSearchRequest request);

    /**
     * 同类推荐
     *
     * @param id 商品id
     */
    @GetMapping("/search/member/relevant/products")
    Result<List<ProductDoc>> relevant(@RequestParam String id);
}